package com.websuites.ejb.jndi;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import com.websuites.utils.LogUtil;

public class JbossJNDIFinderImpl implements JNDIFinder {   
    public Object lookup(InitialContext ctx, String serviceClass){   
        String type = "remote";
        try {
			return ctx.lookup(serviceClass + "/" + type);
		} catch (NamingException e) {
			LogUtil.error("can not lookup ejb service '"+serviceClass + "/" + type+"'");
			LogUtil.error(e.getStackTrace());
		}
		return null;  
    }
    
    public Object lookupJNDI(InitialContext ctx, String jndi){   
        try {
			return ctx.lookup(jndi);
		} catch (NamingException e) {
			LogUtil.error("can not lookup jndi: '"+jndi +"'");
			LogUtil.error(e.getStackTrace());
		}
		return null;  
    }
}